<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateTournamentsTable extends Migration
{
    private $table = 'tournaments';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->table, function (Blueprint $table) {
            $table->increments('id');
            $table->string('title', 100)->comment('联赛标题');
            $table->string('image', 255)->comment('联赛图片');;
            $table->unsignedInteger('entry_fee')->default(0)->comment('入场费');
            $table->tinyInteger('type')->default(1)->comment('联赛类型，1.日联赛 2.月联赛 3.年联赛');
            $table->unsignedInteger('start_time')->default(0)->comment('开始时间');
            $table->unsignedInteger('end_time')->default(0)->comment('结束时间');
            $table->tinyInteger('status')->default(0)->comment('联赛状态，0.未开始 1.进行中 2.结束');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `{$this->table}` COMMENT '联赛表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->table);
    }
}
